package controller

import (
	"github.com/gin-gonic/gin"
	"project/models"
	"project/pkg/app"
)

func GetLogin(c *gin.Context) {
	var logindata models.Login
	c.ShouldBind(&logindata)
	err, info := models.GetLogin(logindata.Username)
	if err != nil {
		app.PswError(c, info, "数据库查无此用户")
		return
	}
	if logindata.Password== info.Password {
		app.OK(c, info, "登陆成功")
	} else {
		app.PswError(c, info, "登录失败")
		return
	}
}
